﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace StudentList
{
    public partial class UCStudent : UserControl
    {
        private Student _student;
        public UCStudent()
        {
            InitializeComponent();
        }

        public ContextMenuStrip PictureBoxContextMenu
        {
            set
            {
                if (value == null)
                    return;
                picStudentPicture.ContextMenuStrip = value;
            }
        }

        public void BindData(Student student)
        {
            _student = student;
            lblStudentNo.Text = student.StudentNo;
            lblStudentName.Text = student.StudentName;
            picStudentPicture.ImageLocation = student.PicUrl;
        }
        public void ReloadPic()
        {
            if (_student == null)
                return;
            picStudentPicture.ImageLocation = _student.PicUrl;
        }
    }
}
